<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title> hello world </title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <h3>Notes: orgintal data programe</h3>
    <div id="root"></div>
</body>

<script>
    // 1. app
    const app = Vue.createApp({
        data() {
            return {
                list: ['hello', 'world', 'dell', 'lee'],
                inputNew: '',
            }
        },
        methods: {
            btnClick() {
                this.content = this.content.split('').reverse().join('');
            },
            addItem() {
                this.list.push(this.inputNew);
            },
        },
        template: `
            <div>
                <h4>List user</h4>
                <div> <input type="text" v-model="inputNew"/> <button v-on:click="addItem">add item</button> </div>
                <ul>
                    <li v-for="(item, index) of list">{{++index}}. {{item}}</li>
                </ul>
                <ol>
                    <todo-item  v-for="(item, index) of list" v-bind:content="item"/>
                </ol>
            </div>
            `
    });

    // 2. components
    app.component('todo-item', {
        props: ['content'],
        data() {
            return {
                item: 'hello dell',
            }
        },
        template: `<li> {{content}}</li>`
    });

    // 3. mount app
    app.mount('#root');
</script>

</html>